package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.GGardener;
import com.ruoyi.system.service.IGGardenerService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GDimission;
import com.ruoyi.system.service.IGDimissionService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 离职信息管理Controller
 * 
 * @author nb
 * @date 2024-05-09
 */
@RestController
@RequestMapping("/system/dimission")
public class GDimissionController extends BaseController
{
    @Autowired
    private IGDimissionService gDimissionService;

    @Autowired
    private IGGardenerService gGardenerService;

    /**
     * 查询mingz列表
     */

    @GetMapping("/lzxxlist")
    public AjaxResult lzxxlist(GGardener gGardener)
    {
        //查询名字
        List<GGardener> list = gGardenerService.selectGGardenerList(gGardener);
        return success(list);
    }


    /**
     * 查询离职信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:dimission:list')")
    @GetMapping("/list")
    public TableDataInfo list(GDimission gDimission)
    {
        startPage();
        List<GDimission> list = gDimissionService.selectGDimissionList(gDimission);
        return getDataTable(list);
    }

    /**
     * 导出离职信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:dimission:export')")
    @Log(title = "离职信息管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GDimission gDimission)
    {
        List<GDimission> list = gDimissionService.selectGDimissionList(gDimission);
        ExcelUtil<GDimission> util = new ExcelUtil<GDimission>(GDimission.class);
        util.exportExcel(response, list, "离职信息管理数据");
    }

    /**
     * 获取离职信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dimission:query')")
    @GetMapping(value = "/{did}")
    public AjaxResult getInfo(@PathVariable("did") Long did)
    {
        return success(gDimissionService.selectGDimissionByDid(did));
    }

    /**
     * 新增离职信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:dimission:add')")
    @Log(title = "离职信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GDimission gDimission)
    {
        return toAjax(gDimissionService.insertGDimission(gDimission));
    }

    /**
     * 修改离职信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:dimission:edit')")
    @Log(title = "离职信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GDimission gDimission)
    {
        return toAjax(gDimissionService.updateGDimission(gDimission));
    }



    /**
     * 删除离职信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:dimission:remove')")
    @Log(title = "离职信息管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dids}")
    public AjaxResult remove(@PathVariable Long[] dids)
    {
        return toAjax(gDimissionService.deleteGDimissionByDids(dids));
    }
}
